package org.ueg.model;

import java.io.Serializable;
import java.util.Collection;


import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;

import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CascadeType;



@Entity
public class Empresa implements Serializable{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	private long idEmp;
	
	@Column(name="nome", length=150)
	private String nomeEmp;
	
	@Column(name="cnpj")
	private String cnpjEmp;
	
	@ManyToMany(fetch=FetchType.EAGER)
	@JoinTable(name="cli_empresa", joinColumns=@JoinColumn(name="idEmp"), 
									inverseJoinColumns=@JoinColumn(name="idCli"))
	
	private Collection<Cliente> clientes;
	
	
	public Collection<Cliente> getCliente() {
		return clientes;
	}

	public void setCliente(Collection<Cliente> clientes) {
		this.clientes = clientes;
	}

	public long getIdEmp() {
		return idEmp;
	}

	public void setIdEmp(long idEmp) {
		this.idEmp = idEmp;
	}

	public String getNomeEmp() {
		return nomeEmp;
	}

	public void setNomeEmp(String nomeEmp) {
		this.nomeEmp = nomeEmp;
	}

	public String getCnpjEmp() {
		return cnpjEmp;
	}

	public void setCnpjEmp(String cnpjEmp) {
		this.cnpjEmp = cnpjEmp;
	}
	
	
}
